package com.cci.kangdao.crmapi;

import com.cci.kangdao.dao.CRMPlatformServiceDao;
import com.cci.kangdao.dao.model.WorkOrderSynchroT;
import com.cci.kangdao.dto.request.AccountEngineRelaRequest;
import com.cci.kangdao.escalation.model.EscalationOrderT;
import com.cci.kangdao.redis.RedisClientUtils;

import java.util.List;
import java.util.Map;

/**
 * @ClassName CRMServiceApi
 * @Description APP与CRM系统Api接口列表
 * @Author leonbreeze
 * @Date 2019/1/19 11:09 AM
 * @Version 1.0
 **/
public interface CRMServiceApi {

	/**
	 * 1、验证发动机编号信息接口 <br>
	 * @author: leonbreeze  <br>
	 * @Description: (2.1 CRM系统同步发动机信息到APP系统)  <br>
	 * @param: @param channalName 服务渠道（DCEC、XCEC、BFCEC、CCI） <br>
	 * @param: @param esn 发动机号  <br>
	 * @date: Jan 23, 2019 4:00:46 PM  <br>
	 * @return: CRMResponeEntity  <br>
	 */
	public CRMResponeEntity verifyEngineInfo(String channalName, String esn);

	/**
	 * @author: leonbreeze @Description: 2、获取审批级别接口 @param: @param channalName
	 *          服务渠道（DCEC、XCEC、BFCEC、CCI） @param: @param stationNo
	 *          服务站编号 @param: @param distance 故障地点和服务站距离 @date: Jan 23, 2019 3:58:36
	 *          PM @return: CRMResponeEntity @throws
	 */
	public CRMResponeEntity getApprovalLevel(String channalName, String stationNo, String distance);

	/**
	 * 3、APP系统同步工单信息到CRM系统 @author: leonbreeze @Description: (2.5
	 * APP系统同步工单信息到CRM系统) @param channalName 服务渠道（DCEC、XCEC、BFCEC、CCI） @param
	 * parameter { "orderNo": "20181107001", "ESN": "11111111", "equipmentNo
	 * ":"冀A11111", "customerName": "李先生"， "customerPhone": "13311111111"，
	 * "faultLocation": "河北省石家庄市"， "faultLat": 38.046647， "faultLon": 114.62898,
	 * "serviceCar ": "服务车车牌号"， "needGoOut ": 1， "faultDesc": "发动机无力"， "stationNo":
	 * "服务站编码", “serviceChannel”:”服务渠道”, “orderSource”:1, “creatPerson”:”李先生”,
	 * “creatTime”:”2018-12-29 00:00:00”, “remark”:”备注” } @date: Jan 23, 2019
	 * 4:30:54 PM @return: CRMResponeEntity @throws
	 */
	public CRMResponeEntity syncAppOrderInfoToCRM(String channalName, CRMPlatformServiceDao serviceDao,
			RedisClientUtils redisClientUtils, Map<String, Object> parameter,Long synchroId);

	/**
	 * 4、CRM系统同步推荐服务站信息到APP系统 @author: leonbreeze @Description: (2.15
	 * CRM系统同步推荐服务站信息到APP系统) @param: @param channalName
	 * 服务渠道（DCEC、XCEC、BFCEC、CCI） @param: @param parameter { "ESN": "12345"
	 * "positionLat": 38.046647, "positionLon": 114.628987， "address ":
	 * "河北省石家庄市黄河大道136号" } @date: Jan 23, 2019 3:56:21 PM @return:
	 * CRMResponeEntity @throws
	 */
	public CRMResponeEntity getRecommendedServiceStations(String channelName, Map<String, Object> parameter);

	/**
	 * 5、APP系统同步服务商经纬度到CRM系统 @author: leonbreeze @Description: (2.4
	 * APP系统传输服务商经纬度到CRM系统) @param channalName 服务渠道（DCEC、XCEC、BFCEC、CCI） @param
	 * lonAndLatInfos [
	 * {"stationNo":"123","positionLat":38.046647,"positionLon":114.628987},
	 * {"stationNo":"123","positionLat":38.046647,"positionLon":114.628987} ] @date:
	 * Jan 23, 2019 4:29:15 PM @return: CRMResponeEntity @throws
	 */
	public CRMResponeEntity updateServiceStationLonAndLatInfos(String channalName,
			List<Map<String, Object>> lonAndLatInfos);

	/**
	 * 6、同步工单状态到CRM系统 <br>
	 * 
	 * @author: leonbreeze <br>
	 * @Description: (2.8 APP系统同步工单状态信息到CRM系统) <br>
	 * @param channalName 服务渠道（DCEC、XCEC、BFCEC、CCI） <br>
	 * @param parameters  工单状态信息参数 { "orderNo": "20181107001", "CRMNo ":
	 *                    "20181107001", "billStatus": 1, "actionTime ":"2018-11-07
	 *                    12:00:00", "directorName": "李经理""， "directorPhone":
	 *                    "13311111112”， "assistEngineerName ": "李工,王工"，
	 *                    "engineerPhone ": "13311111112，13311111112"，
	 *                    "planMileage": "212.32", "travelMileage":"212.32",
	 *                    "reviseMileage":"212.32", "remark":"备注" } <br>
	 * @date: Jan 23, 2019 4:26:46 PM <br>
	 * @return: CRMResponeEntity <br>
	 */
	public CRMResponeEntity syncOrderStatusToCrm(String channalName, CRMPlatformServiceDao serviceDao,
			RedisClientUtils redisClientUtils, Map<String, Object> parameters,Long synchroId);

	/**
	 * 强依赖通知，前置触发缓存异常通知，后强制依赖响应
	 * 
	 * @param channalName      渠道名擦
	 * @param serviceDao       dao
	 * @param redisClientUtils redis
	 * @param parameters       params
	 * @return 响应体
	 */
	public CRMResponeEntity relyOrderStatusToCrm(String channalName, CRMPlatformServiceDao serviceDao,
			RedisClientUtils redisClientUtils, Map<String, Object> parameters);

	/**
	 * 7、APP系统同步用户评价信息到CRM系统 @author: leonbreeze @Description: (2.11
	 * APP系统同步用户评价信息到CRM系统) @param channalName 服务渠道（DCEC、XCEC、BFCEC、CCI） @param
	 * parameters { "orderNo": "20181107001", "hasRepair ": 1, "isServiceSatisfied
	 * ": 1, "serviceContent ":“1，2”, "serviceDescription ": "服务技师已经修复了我的问题"，
	 * "isCharge ": 0, "recommendScores ":3, "recommendDescription ": "1，2"，
	 * "recommendReason ": "非常满意" } @date: Jan 23, 2019 5:55:47 PM @return:
	 * CRMResponeEntity @throws
	 */
	public CRMResponeEntity syncUserAppraisalInfoToCrm(String channalName, CRMPlatformServiceDao serviceDao,
			RedisClientUtils redisClientUtils, Map<String, Object> parameters);


	// ljk 2.2.6 APP系统同步自行诊断信息到CRM系统
	public CRMResponeEntity activeDiagnostics(String channalName, Map<String, Object> parameters,
			RedisClientUtils redisClientUtils);

	// ljk 2.2.7 APP系统同步诊断维修结论信息到CRM系统
	public CRMResponeEntity drConclusion(String channalName, Map<String, Object> parameters,
			RedisClientUtils redisClientUtils);

	/**
	 * 11、工单照片信息 @author: leonbreeze @Description: （2.2.5
	 * APP系统同步工单照片信息到CRM系统） @param channalName 服务渠道（DCEC、XCEC、BFCEC、CCI） @param
	 * picMapList [{ “interfaceName”:“CRM系统同步服务站数据到APP系统”， “data”：“失败同步数据”，
	 * “message”:“失败原因”, “time”:“2019-01-08” }] @date: Jan 23, 2019 6:44:31
	 * PM @return: CRMResponeEntity @throws
	 */
	public CRMResponeEntity syncWorkOrderPics(String channalName, Map<String, Object> picMap,
			RedisClientUtils redisClientUtils);

	/**
	 * 12、同步服务站人员信息 @author: leonbreeze @Description: （2.1.3
	 * APP系统同步服务站人员信息到CRM系统） @param channalName 服务渠道（DCEC、XCEC、BFCEC、CCI） @param
	 * picMapList [{ “interfaceName”:“CRM系统同步服务站数据到APP系统”， “data”：“失败同步数据”，
	 * “message”:“失败原因”, “time”:“2019-01-08” }] @date: Jan 23, 2019 6:44:31
	 * PM @return: CRMResponeEntity @throws
	 */
	public CRMResponeEntity syncServiceStationUser(String channalName, List<Map<String, Object>> picMapList);

	/**
	 * @Author Joe
	 * @Description 13、同步超时24/48H提醒
	 * @Date 8:57 AM 2019/8/28
	 * @Param [channalName, map]
	 * @return com.cci.kangdao.crmapi.CRMResponeEntity
	 **/
	public CRMResponeEntity syncTimeoutAccomplish(String channelName, Map<String, Object> map);

	/**
	 * 同步故障诊断结论至CRM
	 * 
	 * @param channelName
	 * @param map         包含orderNo，CCSSComplainerOrderNo，CCSSOrderNo，diagnosisStepsAndResults，defaultEliminateDes
	 */
	CRMResponeEntity syncTroubleshootingSummary(String channelName, Map<String, Object> map);

	/**
	 * 同步工单报修确认信息至CRM
	 * 
	 * @param channelName 渠道名称
	 * @param map         包含orderNo，CCSSComplainerOrderNo，CCSSOrderNo，ESN，isESNMatched，
	 *                    realESN，isWarranty，warrantyStartDate，startDatePicUrl，faultSymptom，type，remark
	 */
	CRMResponeEntity syncWorkOrderAffirm(String channelName, Map<String, Object> map);

	/**
	 * 同步诊断结果确认信息至CRM
	 * 
	 * @param channelName 渠道名称
	 * @param map         orderNo，CCSSComplainerOrderNo，CCSSOrderNo，faultSymptom，diagnosisStepsAndResults，insureResponsibility，
	 *                    partsList（列表包含partNo，faultCode），isStartRepair
	 */
	CRMResponeEntity syncConfirmationRepair(String channelName, Map<String, Object> map);

	/**
	 * 同步远程解决信息至CRM
	 * 
	 * @param channelName 渠道名称
	 * @param map         orderNo，CCSSComplainerOrderNo，CCSSOrderNo，isClaimant，claimantDescription，emoteSolutionType，remark
	 */
	CRMResponeEntity syncRemoteSolution(String channelName, Map<String, Object> map);

	/**
	 * 重试异常同步信息
	 */
	void retryExceptionSync();

	/**
	 * 根据工单号获取相关索赔信息
	 */
	CRMResponeEntity syncCRMWarrantyInfo(String orderNo);

	/**
	 * APP同步客户故障位置到CRM 参数说明： { "orderNo": "WO20181107001", "caseNo": "XXX",
	 * "faultLat": 123.12, "faultLon": 123.12, "faultLocation": "XXX", "systemTime":
	 * "2019-06-19 00:00:00" "faultProvince": "XXX", "faultCity": "XXX" }
	 * orderNo、caseNo、systemTime为非必填项
	 */
	CRMResponeEntity syncFaultLocationToCRM(Map<String, Object> map);

	/**
	 * xcec售时工单需求 从crm查询主机厂、发动机系统、发动机用途
	 */
	CRMResponeEntity getOEMInfoFromCrmXCEC();

	/**
	 * xcec售时工单需求 从crm查询出某个esn对应的主机厂、发动机系统、发动机用途
	 */
	CRMResponeEntity getOEMInfoFromCrmByEsnXCEC(String esn);

	/**
	 * xcec售时工单需求 同步售时工单到crm
	 */
	CRMResponeEntity syncSaleWorkOrderToCrmXCEC(Map<String, Object> map, WorkOrderSynchroT workOrderSynchro);

	/**
	 * 3.1.0 XCEC 技师维修超时时，同步超时原因到CRM 参数说明： { "CRMNo": "G00131790", "OverTimeReason":
	 * "我是超时原因" }
	 */
	CRMResponeEntity syncOverTimeReasonToXCECCRM(Map<String, Object> map);

	CRMResponeEntity syncEscalationOrderDetail(EscalationOrderT escalationOrder, Integer retryKey);

	/**
	 * @description: 多故障信息同步到SF系统
	 * @param:
	 * @return:
	 * @exception:
	 * @author: shiliqiang
	 * @company: CTY Technology Co.,Ltd
	 * @since: 2021/7/30 15:14
	 * @version: V1.0
	 */
	CRMResponeEntity syncFaultInfoToCRM(String channalName, CRMPlatformServiceDao serviceDao,
			RedisClientUtils redisClientUtils, List parameters, String orderNo);

	/**
	 * @description: 验证站长、技师、信息员SF系统是否存在
	 * @param: null
	 * @return:
	 * @exception:
	 * @author: wunan
	 * @company: Pactera Technology Co.,Ltd
	 * @since: 2021/8/10 15:42
	 * @version: V1.0
	 * @param serviceStationId
	 */
	CRMResponeEntity validationDCECUserInfo(String channalName, String userPhone, Integer userRole, String userName,
			Long serviceStationId);

	void syncServiceAgreementAndEngineToCRM(AccountEngineRelaRequest accountEngineRelaRequest);

	CRMResponeEntity getStationListByCrm(String channalName);

	/**
	 * APP验证资质接口
	 * 
	 * @param serviceStationID 服务站id
	 * @return
	 */
	public CRMResponeEntity validationCert(Long serviceStationID, String orderType);


	public CRMResponeEntity syncRepairAckToCRM(String channalName, CRMPlatformServiceDao serviceDao,
												  RedisClientUtils redisClientUtils, Map<String, Object> parameter);

	//从crm获取campaign任务
	CRMResponeJSONArrayEntity checkCampaignTask(Map<String, Object> map);

	//同步campaign任务状态至crm
	CRMResponeJSONArrayEntity syncDealerCampaignOptionToSF(Map<String, Object> map);

	//同步campaign任务维修完成至crm
	CRMResponeJSONArrayEntity syncDealerCampaignStatusToSF(Map<String, Object> map);
}